package com.ruoyi.web.controller.dibang;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.Fdongbei.domain.dibang.ShdzDo;
import com.ruoyi.system.Fdongbei.domain.dibang.WlccfwDo;
import com.ruoyi.system.Fdongbei.domain.dibang.ZczmDo;
import com.ruoyi.system.Fdongbei.domain.vo.reqvo.KdpReqVo;
import com.ruoyi.system.Fdongbei.domain.vo.reqvo.PageReqInfo;
import com.ruoyi.system.Fdongbei.domain.vo.reqvo.ZaiChangCheReqVo;
import com.ruoyi.system.Fdongbei.service.dibang.WorkService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController()
@RequestMapping("/work")
@ResponseBody
public class WorkController {
    @Resource
    private WorkService workService;


    @PostMapping("/customerInfo")
    public AjaxResult customerInfo(@Validated @RequestBody PageReqInfo pageReqInfo) {
        return workService.getCustomerInfo(pageReqInfo);
    }

    @DeleteMapping("/customer/{id}")
    public AjaxResult delCustomer(@PathVariable("id") Integer id) {
        return workService.delCustomer(id);
    }

    @PostMapping("/customer")
    public AjaxResult addCustomer(@RequestBody ShdzDo shdzDo)  {
        return workService.addCustomer(shdzDo);
    }

    @PutMapping("/customer")
    public AjaxResult updateCustomer(@RequestBody ShdzDo shdzDo) {
        return workService.updateCustomer(shdzDo);
    }



    @PostMapping("/zczmInfo")
    public AjaxResult zczmInfo(@Validated @RequestBody PageReqInfo pageReqInfo) {
        return workService.getZczmInfo(pageReqInfo);
    }

    @DeleteMapping("/zczm/{id}")
    public AjaxResult delZczm(@PathVariable("id") Integer id) {
        return workService.delZczm(id);
    }

    @PostMapping("/zczm")
    public AjaxResult addZczm(@RequestBody ZczmDo zczmDo)  {
        return workService.addZczm(zczmDo);
    }

    @PutMapping("/zczm")
    public AjaxResult updateZczm(@RequestBody ZczmDo zczmDo) {
        return workService.updateZczm(zczmDo);
    }

    @PostMapping("/kdpInfo")
    public AjaxResult kdpInfo(@Validated @RequestBody KdpReqVo kdpReqVo) {
        return workService.getKdpInfo(kdpReqVo);
    }
    @DeleteMapping("/kdp/{id}")
    public AjaxResult delKdp(@PathVariable("id") Integer id) {
        return workService.delKdp(id);
    }

    @PostMapping("/kdp")
    public AjaxResult addKdp(@RequestBody WlccfwDo wlccfwDo)  {
        System.out.println(wlccfwDo);
        return workService.addKdp(wlccfwDo);
    }

    @PutMapping("/kdp")
    public AjaxResult updateKdp(@RequestBody WlccfwDo wlccfwDo) {
        System.out.println(wlccfwDo);
        return workService.updateKdp(wlccfwDo);
    }
    @PostMapping("/zaichangInfo")
    public AjaxResult selectZaiChangInfo(@RequestBody ZaiChangCheReqVo zaiChangCheReqVo){
        return workService.selectZaiChang(zaiChangCheReqVo);
    }
}
